package com.dairy.escape;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;


import lombok.extern.slf4j.Slf4j;
/**
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.util.Scanner;

 * All rights Reserved, Designed By https://gitee.com/es-cape/escape.git
 *
 * @ProjectName: 
 * @Package: 
 * @ClassName: Read
 * @Description: $[description]
 * <p> </p>
 * @Author: escape
 * @Date: 2022/5/24
 * @Version: 
 **/
@Slf4j
public class Read {
    public static void File_read() throws FileNotFoundException {
        File read = new File("E://date/");
        String[] list = read.list();

        for(String itemName : list){
           log.info(itemName);
        }
       log.info("请输入你要读取的日记全名：");
        Scanner sc1=new Scanner(System.in);
        String src= sc1.next();
        String fileName = "E://date/"+src;
       log.info("----------------------------------");
        try (Scanner sc = new Scanner(new FileReader(fileName))) {
            while (sc.hasNextLine()) {  //按行读取字符串
                String line = sc.nextLine();
               log.info(line);
            }
        }
        log.info("===========输出完成！=============");
        log.info(   "已经返回菜单！1，写日记    2.读取日记");

    }
}
